#include  <iostream>
using  namespace  std;

class Point2D
{
public:
    Point2D( double x=0,double y=0):m_x(x),m_y(y)
    {

    }
    void print()
    {
        cout<<"Point2D is ("<<m_x<<" , "<<m_y<<")\n";
    }
protected:
    double m_x,m_y;
};
class Point3D:public Point2D
{
public:
    Point3D( double x=0,double y=0,double z=0):Point2D(x,y),m_z(z)
    {

    }
    void print()
    {
        cout<<"Point3D is ("<<m_x<<" , "<<m_y<<" , "<< m_z<<")\n";
    }
protected:
    double m_z;
};
int main()
{
    Point3D obj3d(1,2,3);
    obj3d.print();
    Point2D *p;
    p=&obj3d;
    p->print();
}
